<template>
  <div id="app" data-server-rendered="true">
    <img src="./assets/logo.png" class="logo">
    id={{id}}
    <Button type="primary" @click="add">+{{number}}</Button><br>

    
    <router-link to="/">home</router-link>
    <router-link to="/hello">hello</router-link>
    <router-link to="/3232">404</router-link>
    <router-link to="/user">user</router-link>
    <router-view></router-view>
    <div>访问的 URL 是：{{url}} </div>
  </div>
</template>

<script>
export default {
  name: 'App',
  data(){
    return {
			id:''
		}
  },asyncData({router,store},data){
    console.log('app asyncData')
    return store.dispatch('set_user',data)
  },beforeCreate(){//禁止定时类和使用window客户端对象 服务端会运行
  console.log('app beforeCreate')
   
      this.axios.get('/list/show/1?app=create').then((res)=>{
        this.id=res.data.id;
        //this.$store.dispatch('set_list');
      })
  },created(){
  },beforeMount(){//定时类放在此入
    
  },mounted(){//定时类放在此入
	
	},computed:{
    url:function(){
      return this.$route.path;
    },
		number(){
			return this.$store.state.number
		},_url(){
			return this.$store.getters.getRoute
		},_list(){
      return this.$store.state.list
    }
	},methods:{
		add(){
			this.$store.dispatch('add_number')
		}
	}
}
</script>

<style lang="less">
@import "./styles/set.less";
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
  font-size:@fontSize;
}
</style>
